<%@ page contentType="application/msexcel" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!-- 以上这行设定本网页为excel格式的网页 -->

<html>
<head>
<title>Excel档案呈现方式</title>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<%
	response.setHeader("Content-disposition",
			"inline; filename=labour.xls");
	//以上这行设定传送到前端浏览器时的档名为test1.xls
	//就是靠这一行，让前端浏览器以为接收到一个excel档
%>
</head>
<body>
	<table id="labour1" border="1">
		<tr>
			<td>序号</td>
			<td>姓名</td>
			<td>部门名称</td>
			<td>岗位名称</td>
			<td>性别</td>
			<td>毛巾</td>
			<td>肥皂</td>
			<td>肥皂粉</td>
			<td>香皂</td>
			<td>洗衣液</td>
			<td>线手套</td>
			<td>备注</td>
		</tr>
	</table>
	<table id="labour" border="1">
		<tr>
			<td>序号</td>
			<td>姓名</td>
			<td>部门名称</td>
			<td>岗位名称</td>
			<td>性别</td>
			<td>毛巾</td>
			<td>肥皂</td>
			<td>肥皂粉</td>
			<td>香皂</td>
			<td>洗衣液</td>
			<td>线手套</td>
			<td>备注</td>
			<%
				int maojin = 0;
				int feizao = 0;
				int feizaofen = 0;
				int xiaozao = 0;
				int xiyiye = 0;
				int xianshoutao = 0;
			%>
			<c:forEach items="${stuffs }" var="stuff">
				<c:set value="${sum+1}" var="sum" />
				<tr>
					<td>${sum}</td>
					<td>${stuff.name }</td>
					<td>${stuff.department }</td>
					<td>${stuff.position }</td>
					<td>${stuff.birthdate }</td>
					<c:if
						test="${stuff.department=='地勤服务部/特种车队' or stuff.department=='地勤服务部/摆渡车队' or stuff.department=='地勤服务部/货运保障队' }">
						<c:if test="${stuff.entertime < '2015-01-01' }">
							<%
								maojin += 4;
								feizao += 12;
								feizaofen += 12;
								xiaozao += 6;
								xiyiye += 2;
								xianshoutao += 12;
							%>
							<td>4</td>
							<td>12</td>
							<td>12</td>
							<td>6</td>
							<td>2</td>
							<td>12</td>
							<td></td>
						</c:if>
						<c:if test="${stuff.entertime >= '2015-01-01' }">
							<%
								maojin += 2;
								feizao += 6;
								feizaofen += 6;
								xiaozao += 3;
								xiyiye += 1;
								xianshoutao += 6;
							%>
							<td>2</td>
							<td>6</td>
							<td>6</td>
							<td>3</td>
							<td>1</td>
							<td>6</td>
							<td></td>
						</c:if>
					</c:if>
					<c:if
						test="${stuff.department!='地勤服务部/特种车队' and stuff.department!='地勤服务部/摆渡车队' and stuff.department!='地勤服务部/货运保障队' }">
						<c:if test="${stuff.entertime < '2015-01-01' }">
							<%
								maojin += 4;
								feizao += 6;
								feizaofen += 6;
								xiaozao += 6;
								xiyiye += 2;
								xianshoutao += 0;
							%>
							<td>4</td>
							<td>6</td>
							<td>6</td>
							<td>6</td>
							<td>2</td>
							<td>0</td>
							<td></td>
						</c:if>
						<c:if test="${stuff.entertime >= '2015-01-01' }">
							<%
								maojin += 2;
								feizao += 3;
								feizaofen += 3;
								xiaozao += 3;
								xiyiye += 1;
								xianshoutao += 0;
							%>
							<td>2</td>
							<td>3</td>
							<td>3</td>
							<td>3</td>
							<td>1</td>
							<td>0</td>
							<td></td>
						</c:if>
					</c:if>
				</tr>
			</c:forEach>
		<tr>
			<td>总计</td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td>毛巾</td>
			<td>肥皂</td>
			<td>肥皂粉</td>
			<td>香皂</td>
			<td>洗衣液</td>
			<td>线手套</td>
			<td>备注</td>

		</tr>
		<tr>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td><%=maojin%></td>
			<td><%=feizao%></td>
			<td><%=feizaofen%></td>
			<td><%=xiaozao%></td>
			<td><%=xiyiye%></td>
			<td><%=xianshoutao%></td>
			<td></td>
		</tr>
	</table>
</body>
</html>
